﻿package com.yc.bran.snack.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */
//dwdjem1989@sandbox.com
public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "9021000128627946";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCKypMK1ZhNZGpWGhG4fqaB10Ji4eaNyR8RV3uTsmFtTSfwSL+HzT0e5FLR6oVOBBfG/Wz0ijOssacyxTqi0OwZFrmIy5lCQoFvexKZSLGIhzZPq5Al7fg5nAwjoIVlfRFmJP/2fajtkmlfvRz/DZ6oqPBEuSonBsEYf2wIkqz7E8YQEaeh7mzvb8+74VI/C9ASlrTVYVIfLMndkae0EBaPgCq+QrSplHj0bSr47t9Tl7eleumbRThyDWW5Bz89/r9f7fhpbOczPH5pClpckzKUGguVdLqZokDujWXSp0f7VoFPXscNYiIaJisHL9GU2wztfF0hPv1wpqIiW796FfD9AgMBAAECggEAMopL+2EGggAz/MCnfVCZX6S8ZveuFimL56u8s278rWmwRn6nSFODk1E/m3NUMbGp2uuEFpSQ9q0GnqVVkd6UaxpsW5UQbSF8stTVU/41r+rU6zQlXLqIbqoVfY/Bo9BkWpbUorTlpAVx28wo1/Pkt7Q1MkFfSTDbdglIlOKcnRzuxKA0HJw78Mp9se+RM4HMGX4125x0y2vYUf6ff/JUPbt1253oREkHLDG+8IG1VvsbtXNg3dlv373Wrv4ZHvqDu+u+R0fiPw7gLtHN2lR734+777kIBhRKV/+Q66gF1JB6cH+AppK7tVssiUsqwOXm5XvmhPfPcNF4GvEWOrCQnQKBgQDXB/u4UpTWRj5VeGzld0nwI/hDpYXwIMhR9hGsYldmZnFtNjIdPRffJ6cFXSDqbbqCN+5maTvr3Z8w8uMWtQ25+KZ8h0nRNO6dzYb5W0Xymjuu9K/KGPLN3hID1wAsB+W4OSghrKf3d+IVp2OgTtacAQIye+h6N0+ctpThW3pBHwKBgQClPAlwzvGozM1jsHW18AxIDliYRy9RN86oZF+lLN2DDXtNU4FHqpqI8gTgg2TE7hj+XvWPA6DHNYKi8+/qpmbZgPybdqEXJExGxlXmYhwAAqtAxpqSDNoNdz9l8Fubd6BLnPz53OjecGA7eLV7nybYRji12gPFU+lkWcDeko7+YwKBgD+KhmGzVXP0Edtj2Jn+JAUoO+aRdQC+TzOZCSPtc3I492+UQj7NnM4+g2ZcXKupfSGZsYLlueU6+h2WyHAfVE0OIvRNbgy6HYDYCPiKdiL4XIaYm5GWybj31E76K3zXYJSNn0REJuZDsLVBX3kxks1KpwGQB+SFj6r5cQke5QN1AoGBAIemeS2mh1iIAlpEJO7fioWhWXRyhFMOGNe/x5HH+na7m62Iz4qxcbrZzc0vsYvG2LgD516ooNbKhFwZHa6rO6Z2sWtEAc4I26IC88R2aPxNNKCyK3WZnW4OpvqeT+abV/qbgEf05yyuXyKT35IEv5QwWiBZQl0+nU3oLWHMOh53AoGAGWWlVd5yyD32AzsVSw+mqxfUt9sBRzLz4guX/uXZYFyvqvGzUdTdATsWvX2Ee6mYrPhOCWCJFa6PRo+g3oceQMNiS4k/xwFRZ1PbtUAa50DAOpaLSWC9tR1RkwTrlHWzf0OO+hOZ7FzHAe6gFUIaK3ZLRWaoXgtW6SNxGt3pZ4g=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAisqTCtWYTWRqVhoRuH6mgddCYuHmjckfEVd7k7JhbU0n8Ei/h809HuRS0eqFTgQXxv1s9IozrLGnMsU6otDsGRa5iMuZQkKBb3sSmUixiIc2T6uQJe34OZwMI6CFZX0RZiT/9n2o7ZJpX70c/w2eqKjwRLkqJwbBGH9sCJKs+xPGEBGnoe5s72/Pu+FSPwvQEpa01WFSHyzJ3ZGntBAWj4AqvkK0qZR49G0q+O7fU5e3pXrpm0U4cg1luQc/Pf6/X+34aWznMzx+aQpaXJMylBoLlXS6maJA7o1l0qdH+1aBT17HDWIiGiYrBy/RlNsM7XxdIT79cKaiIlu/ehXw/QIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8888/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8888/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
	
	// 支付宝日志
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

